go
create PROCEDURE [dbo].[ConsultarHorarioPractica](@dia VARCHAR(20))
AS
BEGIN
    SET NOCOUNT ON;
    SELECT hc.id_Horario,hc.diasemana,hc.horainicio,hc.horafin,hc.fk_Salon
    FROM HorarioClase hc ,SeccionMateria sm, Materia m
	WHERE   hc.diaSemana=@dia and (hc.fk_SeccionMateria = sm.id_Seccion and sm.fk_Materia= m.id_Materia and m.statusMateria='Activo')
	 union all
	    SELECT hc.id_Horario,hc.diasemana,hc.horainicio,hc.horafin,hc.fk_Salon
    FROM HorarioClase hc ,Practica p
	WHERE   hc.diaSemana=@dia and hc.fk_SeccionPractica=p.id_Practica and p.statusPractica='Activo';
    
END